package cn.weiyang.action;

import cn.weiyang.biz.TypesBiz;
import cn.weiyang.biz.TypesBizImpl;
import cn.weiyang.entity.Types;
import com.google.gson.Gson;

import java.io.IOException;
import java.util.List;

/**
 * Created by Administrator on 2017/7/10.
 */
public class TypesAction extends BaseAction{
    public String queryTypes() throws IOException {
        TypesBiz tb=new TypesBizImpl();
        List<Types> types=tb.queryTypes();
        Gson gson = new Gson();
        //在这里转化成json
        String json =gson.toJson(types);
        getResponse().setContentType("application/json;charset=UTF-8");
        getResponse().getWriter().println(json);
        return null;
    }
}
